package nc.hw;

public class HJ21 {

    private static String transferPwd(String pwd) {
        StringBuilder sb = new StringBuilder();
        char[] chars = pwd.toCharArray();
        String[] charMapNumber = new String[]{"0", "1" , "abc", "def","ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
        for (char aChar : chars) {
            if (aChar >= 'a' && aChar <= 'z') {
                // 转换数字键盘的数字
                for (int i = 0; i < charMapNumber.length; i++) {
                    if (charMapNumber[i].indexOf(aChar) != -1) {
                        sb.append(i);
                    }
                }
            } else if (aChar >= 'A' && aChar <= 'Z') {
                char c = (char) ('a' + (aChar - 'A' + 1) % 26);
                sb.append(c);
            } else {
                sb.append(aChar);
            }
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println(transferPwd("YUANzhi1987"));
    }

}
